<template>
  <div class="analysis-container">
    <div class="content">
      <!-- <div>
        <svg-icon icon="quota-active"></svg-icon>
      </div> -->

      <!-- <router-link to="/temp" style="color: #FFF; text-decoration: underline;">GO TO temp</router-link>
      <div>2021-07-05 13:57</div>

      <router-link to="/sub/ddnav" style="color: #FFF; text-decoration: underline;">GO TO DD Nav Test</router-link>

      <div @click="handleDDopen('/sub/ddnav')">
        DD 打开/sub/ddnav页面
      </div> -->

      <!-- <div @click="handleDDopen(`/detail?dateType=year&topic=lg_prfm_sanum_ma_y&code=1`)">
        打开下钻页面 Detail
      </div> -->
      <van-field v-model="topic" label="topic" placeholder="topic" clearable />
      <van-field v-model="targetCode" label="targetCode" placeholder="targetCode" clearable />
      <van-field v-model="id" label="id" placeholder="id" clearable />
      <van-field v-model="dateType" label="dateType" placeholder="dateType" clearable />
      <van-button type="primary" @click="handleClick()">下钻</van-button>
      <no-data></no-data>
    </div>
  </div>
</template>

<script>
import NoData from '@/components/NoData'
export default {
  data() {
    return {
      topic: 'team',
      targetCode: 'sanum',
      id: '1',
      dateType: 'year'
    }
  },
  components: {
    NoData
  },
  methods: {
    handleDDopen(path, params) {
      if (this.$isDD) {
        this.$dd.ready(() => {
          this.$dd.biz.util.openLink({
            url: `${location.origin}${path}?dd_nav_bgcolor=FF0b144b&${params}`,
            onSuccess: result => {
              console.log('通过dd.biz.util.openLink打开页面！', result)
            },
            onFail: err => {
              console.log(err)
            }
          })
        })
      } else {
        this.$router.push(`${path}?${params}`)
      }
    },
    handleClick() {
      const q = `topic=${this.topic}&dateType=${this.dateType}&id=${this.id}&targetCode=${this.targetCode}`
      this.handleDDopen('/detail', q)
    }
  }
}
</script>

<style lang="scss" scoped>
.content {
  font-size: 20px;
  padding: 10px;
  color: #fff;
  div,
  a {
    padding: 20px 10px;
  }
}
</style>
